package com.example.project.service.impl;

import com.example.project.dao.IOffdutyDao;
import com.example.project.entity.Leaves;
import com.example.project.entity.Offduty;
import com.example.project.service.IOffdutyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OffdutyServiceImpl implements IOffdutyService {
    @Autowired
    private IOffdutyDao offdutyDao;

    //实现销假添加方法
    @Override
    public int add(Offduty offduty) {
        return offdutyDao.add(offduty);
    }

    //实现查询所有销假数据的方法
    @Override
    public List<Offduty> getAllOffduty(Offduty offduty) {
        return offdutyDao.getAllOffduty(offduty);
    }

    //删除销假数据
    @Override
    public int deleteOffduty(Offduty offduty) {
        int offdutyValue=0;
        if (offduty.getOffDutyId()!=0){
            offdutyValue=offdutyDao.deleteOffduty(offduty);
        }
        return offdutyValue;
    }

    //实现销假信息的更新
    @Override
    public int updateOffduty(Offduty offduty) {
        int  offdutyValue=0;
        if (offduty.getOffDutyId()!=0){
            offdutyValue=offdutyDao.updateOffduty(offduty);
        }
        return  offdutyValue;
    }

    //实现单挑查询销假数据方法
    @Override
    public Offduty getOffduty(Offduty offduty) {
        Offduty offduty1=new Offduty();
        if(offduty.getOffDutyId()!=0){
            offduty1=offdutyDao.getOffduty(offduty);
        }
        return offduty1;
    }
}
